package org.lex.ftp.ui.actions;

import java.awt.event.ActionEvent;
import javax.swing.KeyStroke;

import org.lex.ftp.FTP;
import org.lex.ftp.ui.OpenDialog;
import org.lex.ftp.util.Resources;
import org.lex.net.ftp.FTPURL;


public class ConnectAction extends FTPAction {
	public ConnectAction(FTP app) {
		super(app);
		this.setName("Connect To...");
		this.setIcon(Resources.getIcon(Resources.ConnectIcon));
		this.setAcceleratorKey(KeyStroke.getKeyStroke("F8"));
	}

	public void actionPerformed(ActionEvent e) {
		OpenDialog open = new OpenDialog(app.getRootWindow());
		open.setLocationRelativeTo(app.getRootWindow());
		FTPURL url = open.showOpenDialog();
		if (null == url)
			return;
		app.getFTPExplorer().open(url);
	}
}
